home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARMCLUB / EUREKA / EUREKA24 / ArcWeb192 / InetDB / Resolver < prev   
Text File  |  1995-11-29  |  9KB  |  269 lines

  1. INetDB - Cacheing Resolver
  2. --------------------------
  3.  
  4.    Copyright (c) 1994 Adam Goodfellow
  5.  
  6. This software is in part based upon source that is 
  7.  
  8.    Copyright (c) 1985, 1988 Regents of the University of California.
  9.    All rights reserved.
  10.  
  11.  
  12. [NOTE:  The InetDB module itself is no longer required by ArcWeb.  However,
  13. the configuration files used by ArcWeb are the same as those required by
  14. InetDB, thus the instructions are the same]
  15.  
  16. Introduction
  17. ============
  18.  
  19. The basic Acorn and FreeNet TCP/IP stacks allows names of hosts with which
  20. you want to communicate to be kept in a local file to save you having to
  21. remember the numeric IP address for each host. For small networks this is
  22. generally quite acceptable.
  23.  
  24. However, for larger networks and especially the Internet, keeping the
  25. hosts file upto date can be very time consuming, if not impossible.
  26.  
  27. To get round this problem, it is normal for one or more machines on a
  28. network to provide host name and IP address databases that are
  29. accessable on a single machine.
  30.  
  31. In actual fact, with very large networks, this database (Domain Name
  32. System or DNS) is distributed amongst a number of machines (called
  33. name-servers), each being responsible for pursuing information about
  34. other networks (domains) on behalf of hosts on its local network (in its
  35. local domain), and answering secific queries about its local network
  36. (domain) from systems on other networks (in other domains).
  37.  
  38. The Resolver provided as part of the INetDB module performs the task of
  39. communicating with nameservers on behalf of many applications written
  40. for the FreeNet and/or Acorn TCP/IP stacks.
  41.  
  42. Normally, as the name-server is a machine connected to your local
  43. network, the time taken to get a reply from a nameserver is quite short,
  44. a fraction of a second on a lightly loaded network and a lightly loaded
  45. name-server.
  46.  
  47. However with heavily loaded networks and nameservers, or if the query
  48. has to be sent over serial connection via a modem to a nameserver on the
  49. Internet, the time taken for the response can be quite long, especially
  50. with the recent upsurge in Internet use. Also, in circumstances of heavy
  51. network conjestion, additional queries caused by resending of requests
  52. that have been deemed lost further degrades network performance.
  53.  
  54. The obvious solution is to somehow reduce the dependancy upon the
  55. name-server for processing queries every time you make a connection to
  56. another named host.
  57.  
  58. This what sets this resolver apart from the types of resolver commonly
  59. found on desktop computers. It remembers information recently obtained
  60. from a name-server in a cache and so is often able to give an instant
  61. responce to a repeat of recent similar query, making it very appropriate
  62. for use where the nameserver is at the other end of a dial up connection
  63. via a modem.
  64.  
  65. The cacheing methods used are such that so long as the name-servers are
  66. providing accurate information about the life time of data retrieved,
  67. then the cache will only give upto date information, and will
  68. automatically remove information considered out of date, ensuring a
  69. fresh copy is read from the nameserver.
  70.   
  71.  
  72. Setting Up
  73. ==========
  74.  
  75. Resolver configuration is stored in the file "!FreeUser.Files.ResConf".
  76. Options in this file are as follows: (See example)
  77.  
  78. nameserver
  79. ----------
  80.  
  81. nameserver <ip_address>
  82.  
  83.  
  84. Internet address (in dot notation) of a name server that the resolver
  85. should query.
  86.  
  87. Up to MAXNS (currently 3) name servers may be listed, one per keyword.
  88.  
  89. If there are multiple servers, the resolver library queries them in the
  90. order listed. If no nameserver entries are present, the default is to
  91. use the name server on the local machine. (The algorithm used is to try
  92. a name server, and if the query times out, try the next, until out of
  93. name servers, then repeat trying all the name servers until a maximum
  94. number of retries are made).
  95.  
  96.  
  97. domain
  98. ------
  99.  
  100. Local domain name.
  101.  
  102. Most queries for names within this domain can use short names relative
  103. to the local domain.
  104.  
  105. If no domain entry is present, the domain is determined from the local
  106. host name returned by gethostname() the domain part is taken to be
  107. everything after the first '.'.
  108.  
  109. Finally, if the host name does not contain a domain part, the root
  110. domain is assumed.
  111.  
  112.  
  113. search
  114. ------
  115.  
  116. Search list for host-name lookup.
  117.  
  118. The search list is normally determined from the local domain name; by
  119. default, it begins with the local domain name, then successive parent
  120. domains that have at least two components in their names. This may be
  121. changed by listing the desired domain search path following the
  122. \fIsearch\fP keyword with spaces or tabs separating the names.
  123.  
  124. Most resolver queries will be attempted using each component of the
  125. search path in turn until a match is found.
  126.  
  127. Note that this process may be slow and will generate a lot of network
  128. traffic if the servers for the listed domains are not local, and that
  129. queries will time out if no server is available for one of the domains.
  130.  
  131. The search list is currently limited to six domains
  132. with a total of 256 characters.
  133.  
  134.  
  135. sortlist
  136. --------
  137.  
  138. Sortlist allows addresses returned by gethostbyname to be sorted.
  139.  
  140. A sortlist is specified by IP address netmask pairs. The netmask is
  141. optional and defaults to the natural netmask of the net. The IP address
  142. and optional network pairs are seperated by slashes. Up to 10 pairs may
  143. be specified.
  144.  
  145. e.g. sortlist 130.155.160.0/255.255.240.0 130.155.0.0
  146.  
  147.  
  148. options
  149. -------
  150.  
  151. Options allows certain internal resolver variables to be modified.
  152.  
  153. The syntax is
  154.  
  155. options <option> ...
  156.  
  157. where <option> is one of the following:
  158.  
  159. debug   sets RES_DEBUG in _res.options.
  160.  
  161. ndots   sets a threshold for the number of dots which must appear in a
  162.         name given to res_query (see resolver) before an initial
  163.         absolute query will be made.  The default for n is 1, meaning
  164.         that if there are any dots in a name, the name will be tried
  165.         first as an absolute name before any search list elements are
  166.         appended to it.
  167.  
  168.  
  169.  
  170. cachesize
  171. ---------
  172.  
  173. Enables the RR cache. Values may be given as <n> bytes, or <n>k kbytes.
  174. Size less than 1024 are rounded upto 1024.
  175.  
  176.  
  177. cacheload
  178. ---------
  179.  
  180. Read RRs from one or more file into the cache. If you are saving the
  181. cache at shutdown, then one of thes files should be the cache file.
  182.  
  183. for eg:
  184. cacheload  resboot rescache
  185.  
  186.  
  187. cachesave
  188. ---------
  189.  
  190. This sets where the cache is saved to at shutdown.
  191.  
  192.  
  193. retry
  194. -----
  195.  
  196. This sets the number of retries attempted to each nameserver (default 4)
  197.  
  198. timeout
  199. -------
  200.  
  201. This sets the min and max timeouts between retrying the same nameserver again.
  202. After each retry, the timeout is doubled upto the max value.
  203.  
  204. Nameserver retries are dstributed through the timeout period, so if the
  205. timeout period is 6 seconds, and 3 nameservers have be specified, the
  206. next nameserver is tried 2 seconds after the first.
  207.  
  208.  
  209. ----
  210.  
  211.  
  212. The domain and search keywords are mutually exclusive. If more than one
  213. instance of these keywords is present, the last instance wins.
  214.  
  215. The search keyword of a system's resolv.conf file can be overridden on a
  216. per-process basis by setting the environment variable LOCALDOMAIN to a
  217. space-separated list of search domains.
  218.  
  219. The options keyword of a system's resolv.conf file can be amended on a
  220. per-process basis by setting the environment variable RES_OPTIONS to a
  221. space-separated list of resolver options as explained above under
  222. options.
  223.  
  224. The keyword and value must appear on a single line, and the keyword
  225. (e.g. nameserver) must start the line.  The value follows the keyword,
  226. separated by white space.
  227.  
  228.  
  229. Programmer Interface
  230. ====================
  231.  
  232. This file is incomplete, there are also a few *commands, some of which
  233. are implemented.
  234.  
  235. The SWI Interface is as follows:
  236.  
  237. SWI Internet_GetHostByName &46000
  238.  
  239. On entry:
  240.   R0 = 0
  241.   R1 = -> host name
  242.  
  243. On exit:
  244.   R1 = pointer to hostent structure or NULL if not found
  245.  
  246.  
  247. SWI Internet_GetHostByAddr &46001
  248. On entry:
  249.   R0 = 0
  250.   R1 = -> host addr
  251.   R2 = len of addr
  252.   R3 = type of addr
  253.  
  254. On exit:
  255.   R1 = pointer to hostent structure, or NULL if not found
  256.  
  257. Where the hostent stucture is defined as below. Note that all addresses
  258. are given in net byte order (the reverse of the normal Acorn byte order).
  259.  
  260. struct hostent {
  261.   char *h_name;                /* Official name of host */
  262.   char **h_aliases;            /* Alternative names for host */
  263.   int  h_addrtype;             /* Host address type */
  264.   int  h_length;               /* Length of each address */
  265.   char **h_addr_list;          /* List of addresses for host */
  266. #define h_addr h_addr_list[0]  /* Address, for back compatability */
  267. };
  268.  
  269.